package cn.com.jonpad.demo06_simple_project.config;

import cn.com.jonpad.demo06_simple_project.component.LoginHandlerInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * SB2.* 建议实现WebMvcConfigurer类更新MVC配置
 */
@Configuration
public class MvcConfig implements WebMvcConfigurer {
	@Override
	public void addViewControllers(ViewControllerRegistry registry) {
		registry.addViewController("/").setViewName("index");
	}

	/**
	 * 拦截器配置
	 * SB默认自动配置中，默认允许访问静态资源
	 * @param registry
	 */
	@Override
	public void addInterceptors(InterceptorRegistry registry) {
		/*registry.addInterceptor(new LoginHandlerInterceptor()).addPathPatterns("/**")
				.excludePathPatterns("/login","/noLogin","/druid/*");*/
	}
}
